<?php include "htmlBase/header.php"; ?>

<?php
include_once 'Entidades/EntidadeBase.php';
include_once 'Entidades/SituacaoHabitacional.php';
$servicoSituacaoHabitacional = new SituacaoHabitacional();

$id_Responsavel = $_GET["id_Responsavel"];
$SituacaoHabitacional = $servicoSituacaoHabitacional->ObterPrimeiro("id_Responsavel = $id_Responsavel");

if ($SituacaoHabitacional == NULL)
{
    $SituacaoHabitacional = new SituacaoHabitacional();
    $SituacaoHabitacional->id_Responsavel = $id_Responsavel;
}

include_once 'Controles/ComboBox.php';
?>

<div class="page secondary">
    <div class="page-header">
        <div class="page-header-content">
            <h1>Situação Habitacional <small>(Cadastro)</small></h1>
             <a href="ResponsavelPainel.php?Id=<?php echo $SituacaoHabitacional->id_Responsavel; ?> "class="back-button big page-back"></a>
        </div>
        <div class="progress-bar" align="rigth">
            <div class="bar bg-color-blue" style="width: 75%"></div>
        </div>
    </div>
    <br/>
    <div class="page secondary">
        <div class="page-region">
            <div class="page-region-content">

                <form action="SituacaoHabitacionalDados.php" method="POST">
                    <input type="hidden" class="with-helper" name="Id" value="<?php echo $SituacaoHabitacional->Id; ?>"/>
                    <input type="hidden" class="with-helper" name="id_Responsavel" value="<?php echo $SituacaoHabitacional->id_Responsavel; ?>"/>

                    <div class="grid">
                        <div class="row">
                            <div class="span6">
                                <div class="input-control text">
                                    <h4>Começou a morar em:</h4>
                                    <?php
                                    ComboBox("Mes", "MesInicioMoradia", $SituacaoHabitacional->MesInicioMoradia);
                                    ?>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="input-control text">
                                    <h4>Ano</h4>
                                    <?php
                                    ComboBox("Ano_100", "AnoInicioMoradia", $SituacaoHabitacional->AnoInicioMoradia);
                                    ?>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="span6">
                                <div class="input-control text">
                                    <h4>Tipo de Residência</h4>
                                    <?php
                                    ComboBox("TipoResidencia", "Tipo", $SituacaoHabitacional->Tipo);
                                    ?>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="input-control text">
                                    <h4>Quantidade de Comodos</h4>
                                    <?php
                                    ComboBox("Numero_15", "QuantidadeComodos", $SituacaoHabitacional->QuantidadeComodos);
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>

            </div>

            <br/>

            <div class="input-control" style="margin-left: auto; margin-right: auto;">
                <button class="standart default" type="submit">Salvar</button>
                <?php
                if ($SituacaoHabitacional->Id != 0)
                {
                    ?>
                    <a href="SituacaoHabitacionalCadastro.php?id_Responsavel=<?php echo $SituacaoHabitacional->id_Responsavel; ?>" class="button standart">Cancelar</a>
                    <?php
                }
                ?>


                <a href="ResponsavelPainel.php?Id=<?php echo $SituacaoHabitacional->id_Responsavel; ?>" class="button standart bg-color-lighten" style="float: right">Voltar</a>
            </div>

            </form>
        </div>
    </div>
</div>

</div>

<?php include "htmlBase/footer.php"; ?>